/*
 * text_edit.h
 * This file is part of gURL
 *
 * Copyright (C) 2013, 2014 - Aleksey Konovalov
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU Library General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Library General Public License for more details.
 *
 *  You should have received a copy of the GNU Library General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef TEXT_EDIT_H
#define TEXT_EDIT_H

#include <gtk/gtk.h>
#include "encoding.h"

#define TEXT_EDIT_TYPE (text_edit_get_type())
#define TEXT_EDIT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TEXT_EDIT_TYPE, TextEdit))
#define TEXT_EDIT_CLASS(cl) (G_TYPE_CHECK_CLASS_CAST((cl), TEXT_EDIT_TYPE, TextEditClass))
#define IS_TEXT_EDIT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), TEXT_EDIT_TYPE))
#define IS_TEXT_EDIT_CLASS(cl) (G_TYPE_CHECK_CLASS_TYPE((cl), TEXT_EDIT_TYPE))
#define TEXT_EDIT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), TEXT_EDIT_TYPE, TextEditClass))

typedef struct _TextEdit TextEdit;
typedef struct _TextEditClass TextEditClass;

/* Signals */
enum {
    ENCODING_CHANGED,
    TEXT_EDIT_LAST_SIGNAL
};

struct _TextEdit {
    GtkBox parent;

    GtkWidget* encoding_combo;
    GtkWidget* topbar;
    GtkWidget* textview;

    Encoding encoding;
};

struct _TextEditClass {
    GtkBoxClass parent_class;

    guint signals[TEXT_EDIT_LAST_SIGNAL];
};


GtkWidget* text_edit_new();
void text_edit_set_editable(TextEdit* self, gboolean editable);
GtkTextBuffer* text_edit_get_buffer(TextEdit* self);
GtkBox* text_edit_get_topbox(TextEdit* self);
void text_edit_set_encoding(TextEdit* self, Encoding enc);
Encoding text_edit_get_encoding(TextEdit* self);

GType text_edit_get_type();

#endif /* TEXT_EDIT_H */
